{include file="public/header" /}
<body>
<style type="text/css">html{background: #f3f3f3;}</style>
<div class="login_page">
    <img class="logo-login" src="__PUBLIC__/images/ logo-login.png" alt="logo">
    <h1>&nbsp;</h1>
    <form class="layui-form" onsubmit="return false;" method="POST" id="form1">
        <div class="layui-form-item">
            <div class="layui-input-inline input-custom-width">
                <input type="text" name="username" id="username" lay-verify="required" placeholder="用户名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline input-custom-width">
                <input type="password" name="password" id="password" lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline input-custom-width">
                <input type="text" name="captcha" lay-verify="required" placeholder="验证码" autocomplete="off" class="layui-input">
                <div class="captcha"><img src="{:captcha_src()}" alt="captche" title='点击切换' onclick="this.src='/captcha?id='+Math.random()"></div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline input-custom-width">
              <button class="layui-btn input-custom-width" id="login1" lay-submit="" lay-filter="login">立即登陆</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
layui.use('form',function(){
    var form = layui.form()
    ,jq = layui.jquery;
});
//登录
var username = $('#username').val();
console.log(username);
var password = $('#password').val();
$("#login1").click(function(){
    $.ajax({
        url: "{:url('login/dologin')}",
        data :$("#form1").serialize(),
        type: "POST",
        success: function( result ) {
            result = eval('('+result+')')
            //console.log(result);
            console.log(result.info);
            layer.open({
                title: '信息' 
                ,content: result.info,
            });
            if(result.status == 'y'){
               location.href='/admin/index';
            }
        }
    });
});
</script>
</body>
</html>